package demo6;

public class Person implements Cloneable{
    public String name;
    public Money money;

    public Person(String name) {
        this.name = name;
        money = new Money();
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        /*return super.clone();*/
        Person tmp = (Person) super.clone();
        tmp.money = (Money) this.money.clone();
        return tmp;
    }

    public String toString() {
        return "Person{" + this.name + ", " + this.money.money + "}";
    }
}
